package jd.monitor.agent;

import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;

import jd.monitor.attach.AgentInitialization;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args ) throws Exception
    {
    	System.out.println(System.getProperty("java.class.path"));
    	URLClassLoader classloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
    	Method add = URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { URL.class });
        add.setAccessible(true);
       File file = new File("D:\\apache-tomcat-6.0.26-app\\wtpwebapps\\cart-app-web-git\\WEB-INF\\lib\\cart-client-1.1.0.2-SNAPSHOT.jar") ;
        add.invoke(classloader, new Object[] { file.toURI().toURL() }) ;
    	System.out.println(System.getProperty("java.class.path"));
		/*new AgentInitialization() ;
        while (true) {
        	Thread.sleep(1000L);
        	say();
		}*/
    }
    
    public static void say(){
    	System.out.println( "Hello World! 22" );
    }
}
